package com.honey.mybatis.generator.model.method;

import com.honey.compilation.java.AbstractJavaCompilation;
import com.honey.compilation.java.JavaKeyWord;
import com.honey.compilation.java.JavaVisibility;
import com.honey.compilation.java.MethodDecoration;
import com.honey.compilation.java.Parameter;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.core.types.JDKFullyQualifiedJavaType;
import com.honey.mybatis.generator.AbstractMethod;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.model.ModelConstant;

public class EnumConstructorMethod  extends AbstractMethod {

	private static final Parameter[] PARAMETER =new Parameter[]{
		new Parameter( JDKFullyQualifiedJavaType.getStringInstance(),ModelConstant.FIELD_VALUE)
	};
	
	private static final String[] BODY = new String[]{
		JavaKeyWord.OPERATION_THIS.toString() + ModelConstant.FIELD_VALUE + JavaKeyWord.OPERATION_BRACKET_EQUALS + ModelConstant.FIELD_VALUE ,
	};
	
	
	public EnumConstructorMethod(AbstractJavaCompilation clazz, MybatisPlugin belongPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(clazz, belongPlugin, introspectSchema, introspectSchemaColumn);
		
	}
	
	@Override
	protected String getMethodName() {
		String answer  = null;
		answer = clazz.getType().getShortName();
		return answer;
	}

	/* (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getMethodDecoration()
	 */
	@Override
	protected MethodDecoration getMethodDecoration() {
		MethodDecoration answer = super.getMethodDecoration(); 
		answer.setVisibility(JavaVisibility.PRIVATE);
		answer.setConstructor(true);
		return answer ;
	}

	/* (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getParameter()
	 */
	@Override
	protected Parameter[] getParameter() {
		
		return PARAMETER;
	}

	/* (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getBody()
	 */
	@Override
	protected String[] getBody() {
		
		return BODY;
	}
	
	
}
